/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.com.cotelasa.scp.entidad;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Jorge
 */
@Entity
@Table(name = "venta_nota_debito",catalog = "bdcotelasa", schema = "cotelasa")
@NamedQueries({
    @NamedQuery(name = "VentaNotaDebito.findAll", query = "SELECT v FROM VentaNotaDebito v"),
    @NamedQuery(name = "VentaNotaDebito.findByCodnd", query = "SELECT v FROM VentaNotaDebito v WHERE v.codnd = :codnd"),
    @NamedQuery(name = "VentaNotaDebito.findByFechand", query = "SELECT v FROM VentaNotaDebito v WHERE v.fechand = :fechand"),
    @NamedQuery(name = "VentaNotaDebito.findByEmpresa", query = "SELECT v FROM VentaNotaDebito v WHERE v.empresa = :empresa"),
    @NamedQuery(name = "VentaNotaDebito.findByRuc", query = "SELECT v FROM VentaNotaDebito v WHERE v.ruc = :ruc"),
    @NamedQuery(name = "VentaNotaDebito.findByDireccion", query = "SELECT v FROM VentaNotaDebito v WHERE v.direccion = :direccion"),
    @NamedQuery(name = "VentaNotaDebito.findByImporte", query = "SELECT v FROM VentaNotaDebito v WHERE v.importe = :importe"),
    @NamedQuery(name = "VentaNotaDebito.findByIgv", query = "SELECT v FROM VentaNotaDebito v WHERE v.igv = :igv"),
    @NamedQuery(name = "VentaNotaDebito.findByTotal", query = "SELECT v FROM VentaNotaDebito v WHERE v.total = :total"),
    @NamedQuery(name = "VentaNotaDebito.findByTotalletras", query = "SELECT v FROM VentaNotaDebito v WHERE v.totalletras = :totalletras"),
    @NamedQuery(name = "VentaNotaDebito.findByNumnd", query = "SELECT v FROM VentaNotaDebito v WHERE v.numnd = :numnd"),
    @NamedQuery(name = "VentaNotaDebito.findBySeriend", query = "SELECT v FROM VentaNotaDebito v WHERE v.seriend = :seriend"),
    @NamedQuery(name = "VentaNotaDebito.findByTipocamb", query = "SELECT v FROM VentaNotaDebito v WHERE v.tipocamb = :tipocamb"),
    @NamedQuery(name = "VentaNotaDebito.findByEstado", query = "SELECT v FROM VentaNotaDebito v WHERE v.estado = :estado")})
public class VentaNotaDebito implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @SequenceGenerator(name = "generadorVentaNotaDebito", sequenceName = "cotelasa.venta_nota_debito_id_seq")
    @GeneratedValue(generator = "generadorVentaNotaDebito") 
    @Basic(optional = false)
    @Column(name = "codnd")
    private Integer codnd;
    @Column(name = "fechand")
    @Temporal(TemporalType.DATE)
    private Date fechand;
    @Column(name = "empresa")
    private String empresa;
    @Column(name = "ruc")
    private String ruc;
    @Column(name = "direccion")
    private String direccion;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "importe")
    private Double importe;
    @Column(name = "igv")
    private Double igv;
    @Column(name = "total")
    private Double total;
    @Column(name = "totalletras")
    private String totalletras;
    @Column(name = "numnd")
    private String numnd;
    @Column(name = "seriend")
    private String seriend;
    @Column(name = "tipocamb")
    private Double tipocamb;
    @Column(name = "estado")
    private Character estado;
    
    @Basic(optional = false)
    @Column(name = "estado_registro")
    private char estadoRegistro;
    
    @Basic(optional = false)
    @Column(name = "usr_creacion")
    private String usrCreacion;
    
    @Basic(optional = false)
    @Column(name = "fec_creacion")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecCreacion;
    
    @Column(name = "usr_modificacion")
    private String usrModificacion;
    
    @Column(name = "fec_modificacion")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecModificacion;
    
    @OneToMany(mappedBy = "codnd",fetch=FetchType.LAZY)
    private Collection<VentaDetalleNotaDebito> ventaDetalleNotaDebitoCollection;
    @JoinColumn(name = "moneda", referencedColumnName = "id")
    @ManyToOne(fetch=FetchType.LAZY)
    private TipoMoneda moneda;
    @JoinColumn(name = "idcliente", referencedColumnName = "id")
    @ManyToOne(fetch=FetchType.LAZY)
    private Cliente idcliente;
    
    @ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name = "id_sede")
    private Sede sede;

    public VentaNotaDebito() {
    }

    public VentaNotaDebito(Integer codnd) {
        this.codnd = codnd;
    }

    public Integer getCodnd() {
        return codnd;
    }

    public void setCodnd(Integer codnd) {
        this.codnd = codnd;
    }

    public Date getFechand() {
        return fechand;
    }

    public void setFechand(Date fechand) {
        this.fechand = fechand;
    }

    public String getEmpresa() {
        return empresa;
    }

    public void setEmpresa(String empresa) {
        this.empresa = empresa;
    }

    public String getRuc() {
        return ruc;
    }

    public void setRuc(String ruc) {
        this.ruc = ruc;
    }

    public String getDireccion() {
        return direccion;
    }

    public void setDireccion(String direccion) {
        this.direccion = direccion;
    }

    public Double getImporte() {
        return importe;
    }

    public void setImporte(Double importe) {
        this.importe = importe;
    }

    public Double getIgv() {
        return igv;
    }

    public void setIgv(Double igv) {
        this.igv = igv;
    }

    public Double getTotal() {
        return total;
    }

    public void setTotal(Double total) {
        this.total = total;
    }

    public String getTotalletras() {
        return totalletras;
    }

    public void setTotalletras(String totalletras) {
        this.totalletras = totalletras;
    }

    public String getNumnd() {
        return numnd;
    }

    public void setNumnd(String numnd) {
        this.numnd = numnd;
    }

    public String getSeriend() {
        return seriend;
    }

    public void setSeriend(String seriend) {
        this.seriend = seriend;
    }

    public Double getTipocamb() {
        return tipocamb;
    }

    public void setTipocamb(Double tipocamb) {
        this.tipocamb = tipocamb;
    }

    public Character getEstado() {
        return estado;
    }

    public void setEstado(Character estado) {
        this.estado = estado;
    }

    @XmlTransient
    public Collection<VentaDetalleNotaDebito> getVentaDetalleNotaDebitoCollection() {
        return ventaDetalleNotaDebitoCollection;
    }

    public void setVentaDetalleNotaDebitoCollection(Collection<VentaDetalleNotaDebito> ventaDetalleNotaDebitoCollection) {
        this.ventaDetalleNotaDebitoCollection = ventaDetalleNotaDebitoCollection;
    }

    public TipoMoneda getMoneda() {
        return moneda;
    }

    public void setMoneda(TipoMoneda moneda) {
        this.moneda = moneda;
    }

    public Cliente getIdcliente() {
        return idcliente;
    }

    public void setIdcliente(Cliente idcliente) {
        this.idcliente = idcliente;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codnd != null ? codnd.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof VentaNotaDebito)) {
            return false;
        }
        VentaNotaDebito other = (VentaNotaDebito) object;
        if ((this.codnd == null && other.codnd != null) || (this.codnd != null && !this.codnd.equals(other.codnd))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "prueba.VentaNotaDebito[ codnd=" + codnd + " ]";
    }

    public char getEstadoRegistro() {
        return estadoRegistro;
    }

    public void setEstadoRegistro(char estadoRegistro) {
        this.estadoRegistro = estadoRegistro;
    }

    public String getUsrCreacion() {
        return usrCreacion;
    }

    public void setUsrCreacion(String usrCreacion) {
        this.usrCreacion = usrCreacion;
    }

    public Date getFecCreacion() {
        return fecCreacion;
    }

    public void setFecCreacion(Date fecCreacion) {
        this.fecCreacion = fecCreacion;
    }

    public String getUsrModificacion() {
        return usrModificacion;
    }

    public void setUsrModificacion(String usrModificacion) {
        this.usrModificacion = usrModificacion;
    }

    public Date getFecModificacion() {
        return fecModificacion;
    }

    public void setFecModificacion(Date fecModificacion) {
        this.fecModificacion = fecModificacion;
    }

    public Sede getSede() {
        return sede;
    }

    public void setSede(Sede sede) {
        this.sede = sede;
    }
    
}
